home *** CD-ROM | disk | FTP | other *** search
- class prop.cloud extends MovieClip
- {
- var runSta;
- var switchOn;
- var eleQtt;
- var eleQttMax;
- var waterQtt;
- var waterQttMax;
- var moveDrct;
- var moveBoundary;
- var moveSpeed;
- var tarXTask;
- var pwOk;
- var onEnterFrame;
- var tarX;
- var ctt;
- var rope;
- function cloud()
- {
- super();
- this.runSta = "rest";
- this.switchOn = false;
- this.eleQtt = 0;
- this.eleQttMax = 1000;
- this.waterQtt = 0;
- this.waterQttMax = 1500;
- this.moveDrct = "left";
- this.moveBoundary = new Array(200,700);
- this.moveSpeed = 2;
- this.setOEF(true);
- this.tarXTask = "none";
- this.pwOk = false;
- }
- function setOEF(p)
- {
- if(p)
- {
- this.onEnterFrame = this.OEF;
- }
- else
- {
- this.onEnterFrame = null;
- }
- }
- function setTask(pTask, pX)
- {
- this.tarXTask = pTask;
- this.tarX = pX;
- this.runSta = "moveToP";
- }
- function disapear()
- {
- this.runSta = "disapear";
- }
- function setChargeOver()
- {
- this.ctt.gotoAndStop("fullPower");
- this.rope.gotoAndStop("off");
- this.runSta = "rest";
- this.switchOn = false;
- this.tarXTask = "none";
- _global.scene.cloudPw = true;
- }
- function setMetalPotOver()
- {
- this.ctt.gotoAndStop("rest");
- this.rope.gotoAndStop("on");
- this.runSta = "moveSelf";
- this.switchOn = true;
- this.tarXTask = "none";
- _global.scene.metalPot = true;
- _global.scene.cloudPw = false;
- }
- function setFullWater()
- {
- _global.scene.pot.steamBtn.enabled = false;
- _global.scene.doorBtn.enabled = true;
- _global.scene.doorBtn._y = _global.scene.steamBtn._y;
- _global.scene.steamBtn.unloadMovie();
- _global.scene.fullWater = true;
- this.rope.gotoAndStop("off");
- this.runSta = "rest";
- this.switchOn = false;
- this.tarXTask = "none";
- }
- function setRainOver()
- {
- _global.scene.rainOver = true;
- _global.scene.stepBtn.enabled = true;
- this.ctt.gotoAndStop("rest");
- this.rope.gotoAndStop("on");
- this.runSta = "moveSelf";
- this.switchOn = true;
- this.tarXTask = "none";
- }
- function cutTreesOver()
- {
- this.ctt.gotoAndStop("rest");
- this.rope.gotoAndStop("off");
- this.runSta = "rest";
- this.switchOn = false;
- this.tarXTask = "none";
- _global.scene.cloudPw = "usedByTrees";
- _global.scene.trees.runSta = "dead";
- }
- function OEF()
- {
- switch(this.runSta)
- {
- case "rest":
- break;
- case "moveSelf":
- this.moveStep();
- break;
- case "moveToP":
- this.moveToStep();
- break;
- case "disapear":
- this.disapearStep();
- }
- }
- function moveStep()
- {
- switch(this.moveDrct)
- {
- case "left":
- if(this._x > this.moveBoundary[0])
- {
- this._x -= this.moveSpeed;
- }
- else
- {
- this.moveDrct = "right";
- }
- break;
- case "right":
- if(this._x < this.moveBoundary[1])
- {
- this._x += this.moveSpeed;
- }
- else
- {
- this.moveDrct = "left";
- }
- }
- }
- function moveToStep()
- {
- var _loc2_ = this.tarX - this._x;
- if(Math.abs(_loc2_) > this.moveSpeed)
- {
- if(_loc2_ > 0)
- {
- this._x += 1.5 * this.moveSpeed;
- }
- else
- {
- this._x -= 1.5 * this.moveSpeed;
- }
- }
- else
- {
- this._x = this.tarX;
- this.doTask();
- }
- }
- function doTask()
- {
- switch(this.tarXTask)
- {
- case "chargePower":
- _global.scene.plugAni.setAni(["play","extend"]);
- this.runSta = "chargePower";
- break;
- case "chargeWater":
- trace("doTask chargeWater");
- _global.ctn.sndCtrl.playSound("snd_breath");
- this.ctt.gotoAndStop("collectingWater");
- this.runSta = "collectingWater";
- break;
- case "cutStone":
- this.ctt.gotoAndStop("cutting");
- this.runSta = "cutting";
- break;
- case "raining":
- this.runSta = "raining";
- this.ctt.gotoAndStop("raining");
- _global.scene.rainAni._visible = true;
- _global.scene.rainAni.play();
- break;
- case "cutTrees":
- this.runSta = "cutTrees";
- this.ctt.gotoAndStop("cutTrees");
- }
- }
- function ropePrs()
- {
- this.switchOn = !this.switchOn;
- if(this.switchOn)
- {
- this.activeMove();
- }
- else
- {
- this.disableMove();
- }
- }
- function activeMove()
- {
- if(this.tarXTask == "none")
- {
- this.runSta = "moveSelf";
- }
- else if(Math.abs(this._x - this.tarX) < this.moveSpeed)
- {
- switch(this.tarXTask)
- {
- case "chargePower":
- case "chargeWater":
- case "cutStone":
- case "raining":
- }
- }
- else
- {
- this.runSta = "moveSelf";
- }
- }
- function disableMove()
- {
- this.runSta = "rest";
- }
- function disapearStep()
- {
- this.ropePrs = null;
- if(this._y > -150)
- {
- this._y -= this.moveSpeed;
- }
- else
- {
- this.runSta = "gameWin";
- this.setOEF(false);
- }
- }
- }
-